﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data.SqlClient;

namespace CivilleWebRole
{
    public partial class ViewSuggestedTasks : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!User.Identity.IsAuthenticated)
            {
                Response.Redirect("~/NotAuthorized.aspx");
            }

            string businessSubTypeID = Request.QueryString["id"];
            if (businessSubTypeID == null)
            {
                String connectionString = ConfigurationManager.ConnectionStrings["CivilleConnectionString"].ConnectionString;
                SqlConnection connection = new SqlConnection(connectionString);
                SqlCommand command = connection.CreateCommand();
                command.CommandText = "SELECT BusinessSubTypeID FROM Stakeholder WHERE Name = '" + User.Identity.Name + "'";
                connection.Open();
                String id = Convert.ToString(command.ExecuteScalar());
                connection.Close();
                BusinessSubTypeIDLbl.Text = id;
            }
            else
            {
                BusinessSubTypeIDLbl.Text = businessSubTypeID;
            }
        }
    }
}